<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        function loginCheck() {
            var username = document.getElementById("username").value;
            var password = document.getElementById("password").value;
            var repassword = document.getElementById("repassword").value;
            console.log(username);
            console.log(password);
            console.log(repassword);
            if (username == null || username == "") {
                alert("用户名不能为空!");
            } else if (password == null || password == "") {
                alert("密码不能为空!");
            } else if (repassword == null || repassword == "") {
                alert("确定密码不能为空!");
            } else if (password != repassword) {
                alert("两次密码不一致！")
            } else {
                var form = document.getElementById("from");
                form.submit();
            }
        }
    </script>
</head>
<body>
<div align="center">
    <form action="./registerServlet" method="post" id="from">
        <div>
            <div>用户名:</div>
            <div><input type="text" id="username" name="username" placeholder="请输入用户名."/></div>
        </div>
        <div>
            <div>密码:</div>
            <div><input type="password" id="password" name="password" placeholder="请输入密码."/></div>
        </div>
        <div>
            <div>确认密码:</div>
            <div><input type="password" id="repassword" name="repassword" placeholder="请再次输入密码."/></div>
        </div>
        <div>
            <div><input type="reset" value="重置"/></div>
            <div><input type="button" value="注册" id="register" onclick="loginCheck()"/></div>
        </div>
    </form>
</div>

</body>
</html>